#region OpenNETCF Copyright Information
/*
Copyright (c) 2007 OpenNETCF Consulting, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software 
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial 
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#endregion

using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;

namespace OpenNETCF.WindowsMobile.Ink.Interfaces
{
    [
      ComImport,
      Guid("615F1D43-8703-4565-88E2-8201D2ECD7B7"),
      InterfaceType(ComInterfaceType.InterfaceIsDual)
    ]
    public interface IInkTransform
    {

        /// <summary>
        /// Represents a 3x3 matrix that, in turn, represents an affine transformation    
        /// </summary>
        [DispId(0x00000001)]
        void Reset();

        /// <summary>
        /// Specifies the translation to apply to the view transform
        /// </summary>
        /// <param name="HorizontalComponent"></param>
        /// <param name="VerticalComponent"></param>
        [DispId(0x00000002),]
        void Translate(
                        [MarshalAs(UnmanagedType.R4)] float HorizontalComponent,
                        [MarshalAs(UnmanagedType.R4)] float VerticalComponent);


        /// <summary>
        /// Specifies the amount, measured in degrees, to rotate the ink in the view 
        /// transform around the specified point, or if no point is specified, the origin    
        /// </summary>
        /// <param name="Degrees"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        [DispId(0x00000003)]
        void Rotate(
                        [MarshalAs(UnmanagedType.R4)] float Degrees,
                        [MarshalAs(UnmanagedType.R4)] float x,
                        [MarshalAs(UnmanagedType.R4)] float y);
        /// <summary>
        /// Specifies reflection in either horizontal or vertical directions
        /// </summary>
        /// <param name="Horizontally"></param>
        /// <param name="Vertically"></param>

        [DispId(0x00000004)]
        void Reflect(
                        bool Horizontally,
                        bool Vertically);
        /// <summary>
        /// Shears the stroke or strokes by the specified horizontal and vertical factors
        /// </summary>
        /// <param name="HorizontalComponent"></param>
        /// <param name="VerticalComponent"></param>

        [DispId(0x00000005)]
        void Shear(
                        [MarshalAs(UnmanagedType.R4)] float HorizontalComponent,
                        [MarshalAs(UnmanagedType.R4)] float VerticalComponent);
        /// <summary>
        /// Specifies the X and Y factors to scale the transform
        /// </summary>
        /// <param name="HorizontalMultiplier"></param>
        /// <param name="VerticalMultiplier"></param>

        [DispId(0x00000006)]
        void ScaleTransform(
                        [MarshalAs(UnmanagedType.R4)] float HorizontalMultiplier,
                        [MarshalAs(UnmanagedType.R4)] float VerticalMultiplier);

        /// <summary>
        /// Gets the InkTransform member data
        /// </summary>
        /// <param name="?"></param>

        [DispId(0x0000000d)]
        void GetTransform(
                        [MarshalAs(UnmanagedType.R4)] out float eM11,
                        [MarshalAs(UnmanagedType.R4)] out float eM12,
                        [MarshalAs(UnmanagedType.R4)] out float eM21,
                        [MarshalAs(UnmanagedType.R4)] out float eM22,
                        [MarshalAs(UnmanagedType.R4)] out float eDx,
                        [MarshalAs(UnmanagedType.R4)] out float eDy);
        /// <summary>
        /// Sets the InkTransform member data
        /// </summary>
        /// <param name="eM11"></param>
        /// <param name="eM12"></param>
        /// <param name="eM21"></param>
        /// <param name="eM22"></param>
        /// <param name="eDx"></param>
        /// <param name="eDy"></param>

        [DispId(0x0000000e)]
        void SetTransform(
                        [MarshalAs(UnmanagedType.R4)] float eM11,
                        [MarshalAs(UnmanagedType.R4)] float eM12,
                        [MarshalAs(UnmanagedType.R4)] float eM21,
                        [MarshalAs(UnmanagedType.R4)] float eM22,
                        [MarshalAs(UnmanagedType.R4)] float eDx,
                        [MarshalAs(UnmanagedType.R4)] float eDy);
        /// <summary>
        /// Returns or sets the element in the first row, first 
        /// column of the affine transform matrix represented by an InkTransform object
        /// </summary>
        /// <returns></returns>
        [DispId(0x00000007)]
        //[property: MarshalAs(UnmanagedType.R4)]
        float eM11 { get; set;}
        [DispId(0x00000008)]
        //[MarshalAs(UnmanagedType.R4)]
        float eM12 { get; set;}
        [DispId(0x00000009)]
        //[MarshalAs(UnmanagedType.R4)]
        float eM21 { get; set;}
        [DispId(0x0000000a)]
        //[MarshalAs(UnmanagedType.R4)]
        float eM22 { get; set;}
        [DispId(0x0000000b)]
        //[MarshalAs(UnmanagedType.R4)]
        float eDx { get; set; }
        [DispId(0x0000000c)]
        //[MarshalAs(UnmanagedType.R4)]
        float eDy { get; set;}
        [DispId(0x0000000f)]
        object Data { get; set;}
    }

    public class InkTransform
    {
        public static IInkTransform CreateInstance()
        {
            Type t = Type.GetTypeFromCLSID(new Guid("E3D5D93C-1663-4A78-A1A7-22375DFEBAEE"));
            return (IInkTransform)Activator.CreateInstance(t);
        }
    }
}
